var express = require('express');
var router = express.Router();

/* GET users listing. */
router.get('/', function(req, res, next) {
  var users=[{
    id:'1',
      name:'a用户'
  },{
      id:'2',
      name:'b用户'
  },{
      id:'3',
      name:'c用户'
  }]
  res.render('demo/users',{
      title:'用户列表',
      users:JSON.stringify(users)
  })
})
router.post("/ajax",function (req,res) {
    if(req.body.input){
        res.json({success:1});
    }

})
router.post("/form",function (req,res) {
    var user=req.body.user;
    var users=[]
    users.push(user)
    res.render("demo/users",{
        title:'用户列表',
        users:JSON.stringify(users)
    })
})


module.exports = router
